package Engine.TileHandling;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.image.BufferedImage;

/**
 * Represents the image of a tile.
 * @author Lueko
 *
 */
public class TileGraphics {

    public int WIDTH;
    public int HEIGHT;
    public BufferedImage image;
    
    /**
     * Creates a TileGraphic out of an image.
     * @param WIDTH Width of the TileGraphic.
     * @param HEIGHT Height of the TileGraphic.
     * @param x X position in the image array.
     * @param y Y position in the image array.
     * @param images Image array with the images.
     */
    public TileGraphics(int WIDTH, int HEIGHT, int x, int y, BufferedImage[][] images) {
        this.WIDTH = WIDTH;
        this.HEIGHT = HEIGHT;
        image = images[x][y];
    }
    
    /**
     * Creates a TileGraphic with a specified color.
     * @param WIDTH Width of the TileGraphic.
     * @param HEIGHT Height of the TileGraphic.
     * @param color Color of the TileGraphic.
     */
    public TileGraphics(int WIDTH, int HEIGHT, Color color) {
        this.WIDTH = WIDTH;
        this.HEIGHT = HEIGHT;
        image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_ARGB);
        Graphics g = image.createGraphics();
        g.setColor(color);
        g.fillRect(0, 0, WIDTH, HEIGHT);
    }
    
}
